<template>
  <div class="son">
    父亲传来的{{ count }}

    <div class="" @click="handle" v-for="(item, index) in msg" :key="index">
      <span>{{ item.name }} - {{ item.age }}</span>
      <slot name="header"> </slot>
    </div>
    <slot name="end"> </slot>
  </div>
</template>

<script setup>
//接收父亲传来的数据
import { ref } from 'vue'

const sObj = ref([
  {
    name: 'zhangsan',
    age: 22
  },
  {
    name: 'lisi',
    age: 24
  },
  {
    name: 'wangwu',
    age: 26
  }
])
const props = defineProps(['msg', 'count'])
const emit = defineEmits(['handlechange'])
const Scount = ref(1)
const handle = () => {
  emit('handlechange', [sObj.value, Scount.value])
}
</script>

<style scoped>
.son {
  width: 80%;

  background-color: skyblue;
}
</style>
